#pragma once

namespace ShRp
{
	namespace UI
	{
		class Widget
		{
		public:
			struct Type
			{
				enum E
				{
					Widget,
					Button,
					Label
				};
			};

		public:
			bool Init(int2 _Pos, int2 _Size);
			virtual void Terminate()		{}
			virtual void Paint() = 0;

			virtual void Move(int2 _NewPos);
			virtual void Resize(int2 _NewSize);

			Type::E GetType()	const	{	return m_Type;	}

			int2 GetPos()		const	{	return m_Pos;	}
			int2 GetSize()		const	{	return m_Size;	}

			virtual void MouseMove();
			virtual void MouseDown( MouseButton::E _Btn )	{}
			virtual void MouseUp( MouseButton::E _Btn )		{}
			virtual void KeyDown( Key::En _Key )			{}
			virtual void KeyRepeat( Key::En _Key )			{}
			virtual void KeyUp( Key::En _Key )				{}

		protected:

			int2 m_Pos, m_Size;
			const Type::E m_Type;

			Control* m_Parent;

			bool m_MouseOver;


			// Only the WidgetFactory can access the constructor.
			friend class ShRp::UI::WidgetFactory;
			Widget(Widget::Type::E _Type, Control* _Parent);
			Widget(const Widget& _Window)
				: m_Type(_Window.GetType())
			{
				Error("Widget copy constructor should not be used.\n");
			}
			Widget()
				: m_Type(Widget::Type::Widget)
			{
				Error("Widget default constructor should not be used.\n");
			}
		};
		typedef std::list<Widget*> WidgetList;
		typedef std::vector<Widget*> WidgetVector;
	};
};